<?php
if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Sidebar',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ));
if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Left Footer',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ));
if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'Right Footer',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ));
if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => '404',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ));
add_filter( 'wp_page_menu', 'greentea_page_nav',11 );
function greentea_page_nav( $menu ) {
 	$links .= wp_list_pages( array( 'title_li' => false, 'echo' => false, 'empty' => true ));
	$menu = preg_replace('/(<li[^>]*>)/','$1<span>',$menu);
	$menu = str_replace( '</li>', '</span></li>', $menu ); 
	return $menu;
}
register_nav_menus( array(
	'primary' => 'Primary Navigation',
) );
function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
    $content = get_the_content($more_link_text, $stripteaser, $more_file);
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]&gt;', $content);

   if (strlen($_GET['p']) > 0) {
      echo $content;
   }
   else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
        $content = substr($content, 0, $espacio);
        $content = $content;
        echo $content;
        echo "&hellip;</p>";
        echo "<span class=\"readmore\"><a href=\"";
        the_permalink();
        echo "\">".$more_link_text."</a></span>";
   }
   else {
      echo $content;
   }
}
add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 270, 140, true ); // 270 pixels wide by 140 pixels tall, hard crop mode
define('HEADER_TEXTCOLOR', '');
define('HEADER_IMAGE', '%s/images/header.jpg'); // %s is the template dir uri
define('HEADER_IMAGE_WIDTH', 980); // use width and height appropriate for your theme
define('HEADER_IMAGE_HEIGHT', 170);
define('NO_HEADER_TEXT', true );
function header_style() { }
function admin_header_style() { }
add_custom_image_header('header_style', 'admin_header_style');
add_custom_background();
?>